function requestFunc(method, url, data, callback) {
    axios({
        method: method ? method : 'post',
        url: url,
        data: Qs.stringify({...data}),
    }).then((response) => {
        if (response.status === 200) {
            callback(response.data)
        }
    }).catch((error) => {
        // console.log("error ==", error)
    });
}


function getQueryVariable(name) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == name) {
            return pair[1];
        }
    }
    return null;
    // var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    // var r = window.location.search.substr(1).match(reg);
    // if (r != null) {
    //     return unescape(r[2]);
    // }
    // return null;
}

window.onscroll = function () {
    //变量scrollTop是滚动条滚动时，距离顶部的距离
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    if (scrollTop > 600) {
        $(".backtop").css({display: 'block'})
    } else {
        $(".backtop").css({display: 'none'})
    }
}


let homeNav = [
    {title: '电影', link: '/classify?tid=1'},
    {title: '电视剧', link: '/classify?tid=2'},
    {title: '综艺', link: '/classify?tid=3'},
    {title: '动漫', link: '/classify?tid=4'},
    {title: '大陆剧', link: '/classify?tid=13'},
    {title: '港台剧', link: '/classify?tid=14'},
];

let navbar1 = {
    nav: [
        {title: '首页', link: '/'},
        {title: '电影', link: '/classify?tid=1'},
        {title: '电视剧', link: '/classify?tid=2'},
        {title: '综艺', link: '/classify?tid=3'},
        {title: '动漫', link: '/classify?tid=4'},
    ],
    bar: [{title: '首页', link: '/'},
        {title: '动作片', link: '/classify?tid=5'},
        {title: '爱情片', link: '/classify?tid=6'},
        {title: '科幻片', link: '/classify?tid=7'},
        {title: '恐怖片', link: '/classify?tid=8'},
        {title: '战争片', link: '/classify?tid=9'},
        {title: '喜剧片', link: '/classify?tid=10'},
        {title: '纪录片', link: '/classify?tid=11'},
        {title: '剧情片', link: '/classify?tid=12'},
        {title: '大陆剧', link: '/classify?tid=13'},
        {title: '港台剧', link: '/classify?tid=14'},
        {title: '欧美剧', link: '/classify?tid=15'},
        {title: '日韩剧', link: '/classify?tid=16'},]
};

let navbar2 = {
    nav: [
        {title: '首页', link: '/'},
        {title: '电影', link: '/classify?tid=1'},
        {title: '电视剧', link: '/classify?tid=2'},
        {title: '综艺', link: '/classify?tid=3'},
        {title: '动漫', link: '/classify?tid=4'},
    ],
    bar: [
        {title: '首页', link: '/'},
        {title: '动作片', link: '/classify?tid=5'},
        {title: '爱情片', link: '/classify?tid=7'},
        {title: '科幻片', link: '/classify?tid=8'},
        {title: '恐怖片', link: '/classify?tid=9'},
        {title: '战争片', link: '/classify?tid=11'},
        {title: '喜剧片', link: '/classify?tid=6'},
        {title: '纪录片', link: '/classify?tid=40'},
        {title: '剧情片', link: '/classify?tid=10'},
        {title: '大陆剧', link: '/classify?tid=13'},
        {title: '港台剧', link: '/classify?tid=14'},
        {title: '欧美剧', link: '/classify?tid=16'},
        {title: '日韩剧', link: '/classify?tid=15'},
    ]
};


let classifyType1 = [
    {title: "全部", value: ''},
    {title: "电影", value: 1},
    {title: "电视剧", value: 2},
    {title: "综艺", value: 3},
    {title: "动漫", value: 4},
    {title: "动作片", value: 5},
    {title: "爱情片", value: 6},
    {title: "科幻片", value: 7},
    {title: "恐怖片", value: 8},
    {title: "战争片", value: 9},
    {title: "喜剧片", value: 10},
    {title: "纪录片", value: 11},
    {title: "剧情片", value: 12},
    {title: "大陆剧", value: 13},
    {title: "港台剧", value: 14},
    {title: "欧美剧", value: 15},
    {title: "日韩剧", value: 16}
];


let classifyType2 = [
    {title: "全部", value: ''},
    {title: "电影", value: 1},
    {title: "电视剧", value: 2},
    {title: "综艺", value: 3},
    {title: "动漫", value: 4},
    {title: "动作片", value: 5},
    {title: "爱情片", value: 7},
    {title: "科幻片", value: 8},
    {title: "恐怖片", value: 9},
    {title: "战争片", value: 11},
    {title: "喜剧片", value: 6},
    {title: "纪录片", value: 40},
    {title: "剧情片", value: 10},
    {title: "国产剧", value: 13},
    {title: "港台剧", value: 14},
    {title: "欧美剧", value: 16},
    {title: "日韩剧", value: 15},
];


Date.prototype.format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};

function format(timestamp, fmt) {
    return new Date(timestamp).format(fmt);
}

function format2(timestamp) {
    return new Date(timestamp).format("yyyy-MM-dd hh:mm:ss")

}

function nowDate() {
    return new Date().format("yyyy-MM-dd")
}

function nowTime() {
    return new Date().format("yyyy-MM-dd hh:mm:ss")
}